<div id="pie" style="width: 500px; height: 500px"></div>
<script type="text/javascript">
  var myChart = echarts.init(document.getElementById('pie'));
  var option = {
    title: {
      text: "崩溃率占比"
    },
    tooltip : {
      trigger: 'item',  
      formatter: "版本：{b} <br/>崩溃率占比 ({d}%)"
    },
    series: [
      {
        type: 'pie',
        radius: ['','58%'],
        data: [
          <% @app.versions.each do |version| %>
          {
            value: <%= (((version.fails.to_f/(version.fails + version.success)).round(2))*100).to_i %>,
            name: '<%= version.version %>'
          },
          <% end %>
        ],
        itemStyle: {
          emphasis: {
              shadowBlur: 10,
              shadowOffsetX: 0,
              shadowColor: 'rgba(0, 0, 0, 0.5)'
          }
        }
      }
    ]
  };
  myChart.setOption(option);
</script>